package Janelas;

import java.awt.Dimension;
import java.awt.Toolkit;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ConsultarArtigos.java
 *
 * Created on 27/10/2010, 23:26:51
 */

/**
 *
 * @author Vitor
 */
public class ConsultaArtigos extends javax.swing.JFrame {

    /** Creates new form ConsultarArtigos */
    public ConsultaArtigos() {
        initComponents();
        this.setTitle("Consultar Artigos");
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
	int alturaTela = d.height;
	int comprimentoTela = d.width;
	setLocation((comprimentoTela)/4, (alturaTela)/8);
        this.setResizable(false);
        this.setDefaultCloseOperation(HIDE_ON_CLOSE);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        bConsulta = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        tCampo = new javax.swing.JTextField();
        cConsulta = new javax.swing.JComboBox();
        bCancela = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        bConsulta.setText("Consultar");
        bConsulta.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                bConsultaMouseClicked(evt);
            }
        });
        bConsulta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bConsultaActionPerformed(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel2.setText("Consultar por:");

        tCampo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tCampoActionPerformed(evt);
            }
        });

        cConsulta.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Título", "Autor Principal", "Outros Autores", "Palavras-chave", "Área de Pesquisa", "Resumo", "Conteúdo", " " }));
        cConsulta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cConsultaActionPerformed(evt);
            }
        });

        bCancela.setText("Cancelar");
        bCancela.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                bCancelaMouseClicked(evt);
            }
        });
        bCancela.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bCancelaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(5, 5, 5)
                        .addComponent(jLabel2))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(tCampo, javax.swing.GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(bConsulta)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(bCancela))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(31, 31, 31)
                        .addComponent(cConsulta, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cConsulta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bCancela, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bConsulta))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void bConsultaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bConsultaActionPerformed
        // TODO add your handling code here:



    }//GEN-LAST:event_bConsultaActionPerformed

    private void tCampoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tCampoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tCampoActionPerformed

    private void cConsultaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cConsultaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cConsultaActionPerformed

    private void bCancelaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bCancelaActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_bCancelaActionPerformed

    private void bCancelaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bCancelaMouseClicked
        // TODO add your handling code here:
        this.setVisible(false);
    }//GEN-LAST:event_bCancelaMouseClicked

    private void bConsultaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bConsultaMouseClicked
        // TODO add your handling code here:
        String s = (String)cConsulta.getSelectedItem();
        if(s.equals("Título")){
            System.out.println("atim");
        }
        if(s.equals("Autor Principal")){
            System.out.println("Ronaldo");
        }
    }//GEN-LAST:event_bConsultaMouseClicked

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ConsultaArtigos().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bCancela;
    private javax.swing.JButton bConsulta;
    private javax.swing.JComboBox cConsulta;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JTextField tCampo;
    // End of variables declaration//GEN-END:variables

}
